from time import sleep

from appium import webdriver
from appium.webdriver.common.touch_action import TouchAction

caps = {
    'platformName': 'Android',
    'platformVersion': '5.1.1',
    'deviceName': 'NNN',
    'appPackage': 'com.android.settings',
    'appActivity': '.Settings'}
driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub',
                          desired_capabilities=caps
                          )

driver.set_network_connection(2)

driver.press_keycode(24)
driver.press_keycode(24)
driver.press_keycode(24)
driver.press_keycode(24)

driver.open_notifications()
# TA = TouchAction(driver)
sleep(5)
driver.find_element_by_xpath('//*[@text = "9月27日星期一"]').click()
# TA.tap(x=940, y=50)
